<?php


use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Auth;

/*
|--------------------------------------------------------------------------
| Dash Routes
|--------------------------------------------------------------------------
|
| Consiste em todas as rotas do painel administrativo.
|
*/

Route::group(['middleware' => 'auth'], function () {
    Route::get('/home', function () {
        return redirect()->route('dash');
    });
    /*
     * Dash Home
     */
    Route::get('/dash', 'HomeController@index')->name('dash');
    Route::name('dash.')->prefix('/dash/')->group(function () {

        /*
         * ACL
         */
        Route::resource('roles', 'ACL\\RoleController');
        Route::resource('users', 'ACL\\UserController');
        /*
         * Tutorial
         */
        Route::get('tutorial', 'TutorialController@Index')->name('tutorial');
        Route::name('tutorial.')->prefix('/tutorial')->group(function () {
            Route::get(':c', 'TutorialController@create')->name('create');
            Route::get(':e{id}', 'TutorialController@edit')->name('edit');
            Route::put(':p{id}', 'TutorialController@update')->name('put');
            Route::delete(':d{id}', 'TutorialController@delete')->name('delete');
            Route::post(':s', 'TutorialController@store')->name('store');
            Route::post(':u', 'TutorialController@upload')->name('upload');
        });

        /*
         * Endereco
         */
        Route::get('endereco', 'EnderecoController@index')->name('endereco');
        Route::name('endereco.')->prefix('/endereco')->group(function () {
            Route::get(':c', 'EnderecoController@create')->name('create');
            Route::get(':e{id}', 'EnderecoController@edit')->name('edit');
            Route::put(':p{id}', 'EnderecoController@update')->name('put');
            Route::delete(':d{id}', 'EnderecoController@delete')->name('delete');
            Route::post(':s', 'EnderecoController@store')->name('store');
            Route::post(':u', 'EnderecoController@upload')->name('upload');
        });

        /*
         * Download
         */
        Route::get('download', 'DownloadController@index')->name('download');
        Route::name('download.')->prefix('/download')->group(function () {
            Route::get(':c', 'DownloadController@create')->name('create');
            Route::get(':e{id}', 'DownloadController@edit')->name('edit');
            Route::put(':p{id}', 'DownloadController@update')->name('put');
            Route::get(':d{id}', 'DownloadController@delete')->name('delete');
            Route::post(':s', 'DownloadController@store')->name('store');
            Route::post(':u', 'DownloadController@upload')->name('upload');
        });
        /*
         * Termos
         */
        Route::get('termo', 'TermoController@index')->name('termo');
        Route::name('termo.')->prefix('/termo')->group(function () {
            Route::get(':c', 'TermoController@create')->name('create');
            Route::get(':e{id}', 'TermoController@edit')->name('edit');
            Route::put(':p{id}', 'TermoController@update')->name('put');
            Route::delete(':d{id}', 'TermoController@delete')->name('delete');
            Route::post(':s', 'TermoController@store')->name('store');
            Route::post(':u', 'TermoController@upload')->name('upload');
        });
        /*
         * Contatos
         */
        Route::get('contato', 'ContatoController@index')->name('contato');
        Route::name('contato.')->prefix('/contato')->group(function () {
            Route::get(':r{id}', 'ContatoController@read')->name('read');
            Route::put(':comment{id}', 'ContatoController@comment')->name('comment');
            Route::delete(':d{id}', 'ContatoController@delete')->name('delete');
        });
        /*
         * Associados
         */
        Route::get('associado', 'AssociadoController@index')->name('associado');
        Route::name('associado.')->prefix('/associado')->group(function () {
            Route::get(':c', 'AssociadoController@create')->name('create');
            Route::get(':e{id}', 'AssociadoController@edit')->name('edit');
            Route::put(':u{id}', 'AssociadoController@update')->name('update');
            Route::delete(':d{id}', 'AssociadoController@delete')->name('delete');
            Route::post(':s', 'AssociadoController@store')->name('store');
        });

        /*
         * Blog
         */
        Route::get('blog', 'BlogController@index')->name('blog');
        Route::name('blog.')->prefix('/blog')->group(function () {
            Route::get(':c', 'BlogController@create')->name('create');
            Route::get(':e{id}', 'BlogController@edit')->name('edit');
            Route::put(':p{id}', 'BlogController@update')->name('put');
            Route::delete(':d{id}', 'BlogController@delete')->name('delete');
            Route::post(':s', 'BlogController@store')->name('store');
            Route::post(':u', 'BlogController@upload')->name('upload');
        });

    });


});